<?php
// | 订单
// +----------------------------------------------------------------------
// | Author: carl <469714167@qq.com>
// +----------------------------------------------------------------------
// | Datetime: 2017-8-29 17:55
// +----------------------------------------------------------------------

namespace app\wx\controller;

use think\Validate;
use think\Log;
use think\Db;
use org\BaiduMap;
use think\Model;
use think\Loader;
use org\HMongodb;
use app\dv1\model\Shop;

class Order extends Init
{
    private $OrderModel;

    protected function _initialize()
    {
        parent::_initialize();
        $this->OrderModel = Loader::model('Order');
    }

    public function OrderDetail(){
        $param = input('post.');
        $validate = [
            'orderId' => 'require',
        ];
        $result = $this->validate($param, $validate);
        if (true !== $result) {
            return ['data' => '', 'code' => 400, 'msg' => '参数不正确或者参数不全', 'status' => false];
        }
        $data = $this->OrderModel->getParkOrderDetail($param);
        if($data){
            return ['data' => $data, 'code' => 200, 'msg' => '查询成功', 'status' => true];
        }else{
            return ['data' => [], 'code' => 400, 'msg' => '订单不存在', 'status' => false];
        }

    }

        public function OrderList(){
        $param = input('post.');
        $validate = [
            'uid' => 'require',
        ];
        $result = $this->validate($param, $validate);
        if (true !== $result) {
            return ['data' => '', 'code' => 400, 'msg' => '参数不正确或者参数不全', 'status' => false];
        }
        $data = $this->OrderModel->getParkOrderList($param);
        if($data){
            return ['data' => $data, 'code' => 200, 'msg' => '查询成功', 'status' => true];
        }else{
            return ['data' => [], 'code' => 400, 'msg' => '订单不存在', 'status' => false];
        }

    }
}